package model.User.service.Impl;


import model.User.entity.User;
import model.User.mapper.UserMapper;
import model.User.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * Created by Sunshine、宸 on 2019/6/23.
 */
@Service
@Transactional
public class UserServiceImpl implements IUserService {
   @Autowired private UserMapper userMapper;
    @Override
    public void Save(User user) {
        userMapper.Save(user);
    }

    @Override
    public void delById(Integer user_id) {
        userMapper.delById(user_id);
    }



    @Override
    public User findById(Integer user_id) {
        User u=userMapper.findById(user_id);
        return u;
    }

    @Override
    public List<User> findAll() {
        List<User>users=userMapper.findAll();

        return users;
    }

    //根据用户名进行模糊查询
    @Override
    public List<User>findMoHu(String user_name) {
        List<User> users=userMapper.findMoHu(user_name);
        return users;
    }

    @Override
    public void updateByUser(User user) {
         userMapper.updateUser(user);
    }

    @Override
    public User finByPhone(String user_phone) {

        return userMapper.findByPhone(user_phone);
    }

    @Override
    public User findByEmail(User user) {
        return userMapper.findByEmail(user);
    }
}
